package com.tanhua.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnnouncementVo {

    private String id;
    private String title;
    private String description;
    private String createDate;

    public static AnnouncementVo init(Long id, String title, String description, Date created){
        AnnouncementVo vo = new AnnouncementVo();
        vo.setId(id.toString());
        vo.setDescription(description);
        vo.setTitle(title);
        Date date = new Date(created.getTime());
        vo.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
        return vo;
    }
}
